<%= header %>
<script src="/vendor/zone/dist/zone.js" type="text/javascript"></script>
<script src="48-zonejs-mo.js" type="text/javascript"></script>
<%= boomerangScript %>
<script type="text/javascript">
var img, xhr, beaconCount = 0;
window.ZONE_MO_USED = false;
BOOMR.subscribe("beacon", function(vars) {
	beaconCount++;
	if (beaconCount === 1) {
		setTimeout(function() {
			xhr = new XMLHttpRequest();
			xhr.open("GET", "/delay?delay=400&file=/pages/07-autoxhr/support/script200.js");
			xhr.addEventListener("load", function() {
				img = document.createElement("img");
				img.src = "/delay?delay=1000&id=xhr&file=/pages/07-autoxhr/support/img.jpg&rnd" + Math.random();
				document.body.appendChild(img);
			});
			xhr.send(null);
		}, 100);
	}
});

var zoneSpec = {
	name: "Zone1",
	onInvoke: function(delegate, current, target, callback, applyThis, applyArgs, source) {
		if (source && source.match(/MutationObserver/)) {
			window.ZONE_MO_USED = true;
		}
		return delegate.invoke(target, callback, applyThis, applyArgs, source);
	}
};

var Zone1 = Zone.current.fork(zoneSpec);
Zone1.run(function() {
	BOOMR_test.init({
		testAfterOnBeacon: BOOMR.plugins.AutoXHR ? 2 : 1,
		instrument_xhr: true,
		ignoreGlobals: ["__zone_symbol__ON_PROPERTYerror", "__zone_symbol__errorfalse"]
	});
});
</script>
<%= footer %>
